package scalab.caches.cdp

import scalab.core.{ChangeDetectionPolicy, Resource}
import scalab.core.dependencies.Dependency
import scalab.utils.{Digest, Timestamp}
import java.security.MessageDigest

/**
* Defines a Timestamp change detection policy.
*/
trait TimestampCDP extends ChangeDetectionPolicy{

	def hashDependency(md: MessageDigest, dep: Dependency) =
		Digest.update(md, dep.canonicalPath + dep.isSoft + Timestamp(dep))

	def hashResource(md: MessageDigest, res: Resource){
		Digest.update(md, res.canonicalPath + Timestamp(res))
	}
}
